<?php

/**
 * This is the model class for table "mcrjo_paymentTransaction".
 *
 * The followings are the available columns in table 'mcrjo_paymentTransaction':
 * @property string $txn_id
 * @property string $payer_email
 * @property string $payer_id
 * @property string $address_name
 * @property string $address_street
 * @property string $address_city
 * @property string $address_state
 * @property string $address_zip
 * @property string $address_country
 * @property string $address_country_code
 * @property string $first_name
 * @property string $last_name
 * @property string $mc_currency
 * @property string $mc_gross
 * @property string $tax
 * @property string $handling_amount
 * @property string $mc_fee
 * @property string $payment_date
 * @property string $payment_status
 * @property string $custom
 * @property string $item_name
 * @property integer $quantity
 * @property string $payment_gross
 * @property string $shipping
 * @property string $item_number
 * @property string $receiver_id
 * @property string $receiver_email
 * @property string $payment_fee
 * @property string $address_status
 * @property string $protection_eligibility
 * @property string $payer_status
 * @property string $business
 * @property string $verify_sign
 * @property string $payment_type
 * @property string $txn_type
 * @property string $transaction_subject
 */
class PaymentTransaction extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return PaymentTransaction the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'mcrjo_paymenttransaction';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('txn_id', 'required'),
			array('quantity', 'numerical', 'integerOnly'=>true),
			array('txn_id, address_country, address_country_code', 'length', 'max'=>64),
			array('payer_email, payer_id, address_name, address_street, address_city, address_state, address_zip, first_name, last_name, payment_date, payment_status, custom, item_name, payment_gross, item_number, receiver_id, receiver_email, payment_fee, address_status, protection_eligibility, payer_status, business, verify_sign, payment_type, txn_type, transaction_subject', 'length', 'max'=>255),
			array('mc_currency', 'length', 'max'=>32),
			array('mc_gross, tax, handling_amount, mc_fee, shipping', 'length', 'max'=>10),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('txn_id, payer_email, payer_id, address_name, address_street, address_city, address_state, address_zip, address_country, address_country_code, first_name, last_name, mc_currency, mc_gross, tax, handling_amount, mc_fee, payment_date, payment_status, custom, item_name, quantity, payment_gross, shipping, item_number, receiver_id, receiver_email, payment_fee, address_status, protection_eligibility, payer_status, business, verify_sign, payment_type, txn_type, transaction_subject', 'safe', 'on'=>'search'),
			array('txn_id, payer_email, payer_id, address_name, address_street, address_city, address_state, address_zip, address_country, address_country_code, first_name, last_name, mc_currency, mc_gross, tax, handling_amount, mc_fee, payment_date, payment_status, custom, item_name, quantity, payment_gross, shipping, item_number, receiver_id, receiver_email, payment_fee, address_status, protection_eligibility, payer_status, business, verify_sign, payment_type, txn_type, transaction_subject', 'safe', 'on'=>'ipn'),
			array('txn_id, payer_email, payer_id, address_name, address_street, address_city, address_state, address_zip, address_country, address_country_code, first_name, last_name, mc_currency, mc_gross, tax, handling_amount, mc_fee, payment_date, payment_status, custom, item_name, quantity, payment_gross, shipping, item_number, receiver_id, receiver_email, payment_fee, address_status, protection_eligibility, payer_status, business, verify_sign, payment_type, txn_type, transaction_subject','default','value'=>'','setOnEmpty'=>true,'on'=>'insert,update,ipn'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'txn_id' => 'Txn',
			'payer_email' => 'Payer Email',
			'payer_id' => 'Payer',
			'address_name' => 'Address Name',
			'address_street' => 'Address Street',
			'address_city' => 'Address City',
			'address_state' => 'Address State',
			'address_zip' => 'Address Zip',
			'address_country' => 'Address Country',
			'address_country_code' => 'Address Country Code',
			'first_name' => 'First Name',
			'last_name' => 'Last Name',
			'mc_currency' => 'Mc Currency',
			'mc_gross' => 'Mc Gross',
			'tax' => 'Tax',
			'handling_amount' => 'Handling Amount',
			'mc_fee' => 'Mc Fee',
			'payment_date' => 'Payment Date',
			'payment_status' => 'Payment Status',
			'custom' => 'Custom',
			'item_name' => 'Item Name',
			'quantity' => 'Quantity',
			'payment_gross' => 'Payment Gross',
			'shipping' => 'Shipping',
			'item_number' => 'Item Number',
			'receiver_id' => 'Receiver',
			'receiver_email' => 'Receiver Email',
			'payment_fee' => 'Payment Fee',
			'address_status' => 'Address Status',
			'protection_eligibility' => 'Protection Eligibility',
			'payer_status' => 'Payer Status',
			'business' => 'Business',
			'verify_sign' => 'Verify Sign',
			'payment_type' => 'Payment Type',
			'txn_type' => 'Txn Type',
			'transaction_subject' => 'Transaction Subject',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('txn_id',$this->txn_id,true);

		$criteria->compare('payer_email',$this->payer_email,true);

		$criteria->compare('payer_id',$this->payer_id,true);

		$criteria->compare('address_name',$this->address_name,true);

		$criteria->compare('address_street',$this->address_street,true);

		$criteria->compare('address_city',$this->address_city,true);

		$criteria->compare('address_state',$this->address_state,true);

		$criteria->compare('address_zip',$this->address_zip,true);

		$criteria->compare('address_country',$this->address_country,true);

		$criteria->compare('address_country_code',$this->address_country_code,true);

		$criteria->compare('first_name',$this->first_name,true);

		$criteria->compare('last_name',$this->last_name,true);

		$criteria->compare('mc_currency',$this->mc_currency,true);

		$criteria->compare('mc_gross',$this->mc_gross,true);

		$criteria->compare('tax',$this->tax,true);

		$criteria->compare('handling_amount',$this->handling_amount,true);

		$criteria->compare('mc_fee',$this->mc_fee,true);

		$criteria->compare('payment_date',$this->payment_date,true);

		$criteria->compare('payment_status',$this->payment_status,true);

		$criteria->compare('custom',$this->custom,true);

		$criteria->compare('item_name',$this->item_name,true);

		$criteria->compare('quantity',$this->quantity);

		$criteria->compare('payment_gross',$this->payment_gross,true);

		$criteria->compare('shipping',$this->shipping,true);

		$criteria->compare('item_number',$this->item_number,true);

		$criteria->compare('receiver_id',$this->receiver_id,true);

		$criteria->compare('receiver_email',$this->receiver_email,true);

		$criteria->compare('payment_fee',$this->payment_fee,true);

		$criteria->compare('address_status',$this->address_status,true);

		$criteria->compare('protection_eligibility',$this->protection_eligibility,true);

		$criteria->compare('payer_status',$this->payer_status,true);

		$criteria->compare('business',$this->business,true);

		$criteria->compare('verify_sign',$this->verify_sign,true);

		$criteria->compare('payment_type',$this->payment_type,true);

		$criteria->compare('txn_type',$this->txn_type,true);

		$criteria->compare('transaction_subject',$this->transaction_subject,true);

		return new CActiveDataProvider(get_class($this), array(
			'criteria'=>$criteria,
		));
	}
}